import java.util.Scanner;
import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-07-07
 * Time: 21:58
 */
public class test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            String s = in.next();
            int n = s.length();
            Stack<Character> stack = new Stack<>();
            for(int i=0;i<n;i++){
                char ch = s.charAt(i);
                if(stack.isEmpty()){
                    stack.push(ch);
                }else if(stack.peek()==ch){
                    stack.pop();
                }else {
                    stack.push(ch);
                }
            }
            if(stack.isEmpty()){
                System.out.println("0");
            }else{
                StringBuilder sb = new StringBuilder();
                while (!stack.isEmpty()){
                    sb.append(stack.pop());
                }
                s = sb.reverse().toString();
                System.out.println(s);
            }
        }
    }
}
